home *** CD-ROM | disk | FTP | other *** search
- ;-------------------------bin8out routine begins--------------------------+
- ; from BLUEBOOK OF ASSEMBLY ROUTINES FOR IBM PC & XT.
- ; page : 43
- ;
- ; ROUTINE FOR CONVERSION FROM 8-BIT BINARY TO ASCII BINARY
- ;
- ; FUNCTION: This routine accepts an 8-bit binary number in the DL register
- ; and converts it to ASCII binary form which is sent to the std output
- ; device.
- ; INPUT: Upon entry an 8-bit binary is in the DL register
- ; OUTPUT: A string of ASCII digits representing a binary number is sent
- ; out through the std output device.
- ; REGISTERS USED: No registers are modified. DL is used for input
- ; SEGMENTS REFERENCED: None
- ; ROUTINES CALLED: STDOUT
- ; SPECIAL NOTES: None
- ;
- ; ROUTINE TO CONVERT FROM INTERNAL 8-BIT BINARY TO ASCII BINARY
- ;
- bin8out proc far
- ;
- push cx ; save registers
- push ax
- ;
- mov cx,8 ; loop for a count of 8
- bin8out1:
- rol dl,1 ; rotate DL left once
- mov al,dl ; move into AL
- and al,1 ; just keep digit
- add al,30h ; adjust AL to ASCII
- call stdout ; output to console
- loop bin8out1 ; again until cx is 0
- ;
- pop ax ; restore registers
- pop cx
- ret ; return
- ;
- bin8out endp
- ;-------------------------bin8out routine ends---------------------------+